package com.logistics.heart.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.logistics.heart.service.HeartService;
import com.logistics.utils.exception.MessageException;
import com.logistics.utils.response.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("lgs/heart")
public class HeartController {

    @Autowired
    private HeartService heartService;

    /**
     * 车辆归位
     * @param ip
     * @return
     * @throws JsonProcessingException
     * @throws MessageException
     */
    @PutMapping("homing/{ip}")
    public ResponseEntity homing(@PathVariable("ip") String ip) throws JsonProcessingException, MessageException {
        heartService.homing(ip);
        return ResponseUtil.success();
    }
}
